<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>
            药品管理
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="../css/x-admin.css" media="all">
        <link rel="stylesheet" href="../css/pag.css" media="all">
        <link rel="stylesheet" href="../lib/layui/css/layui.css" media="all">
    </head>
    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>药品管理</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
        </div>
        <div class="x-body">
          <form class="layui-form x-center" action="" style="width:85%">
                <div class="layui-form-pane">
                  <div class="layui-form-item">
                    <label class="layui-form-label">药品编号</label>
                    <div class="layui-input-inline" style="width:100px">
                      <input type="text" name="name"  placeholder="药品编号" autocomplete="off" class="layui-input">
                    </div>
                    <label class="layui-form-label">药品名称</label>
                    <div class="layui-input-inline" style="width:100px">
                      <input type="text" name="name"  placeholder="药品名称" autocomplete="off" class="layui-input">
                    </div>
                    <label class="layui-form-label">药品类别</label>
                    <div class="layui-input-inline" style="width:200px">
                        <select name="quiz" style="width: 200px">
                            <option value="">请选择类别</option>
                            <option value="1">保健品</option>
                            <option value="0">营养品</option>
                        </select>
                    </div>

                  </div>
                </div>
              <div class="layui-form-item">
                  <label  class="layui-form-label">
                  </label>
                  <button  class="layui-btn">
                      搜索
                  </button>
              </div>
            </form>
            <div class="tools">
    <ul class="toolbar">
      <li><span><img src="../images/t03.png" /></span>批量删除</li>
      <li onclick="user_management_add('添加药品','${pageContext.request.contextPath}/jsp/yaopin_add.jsp','1100','500')"><span><img src="../images/t01.png" /></span>添加</li>
      <li><span><img src="../images/t10.png" /></span>导入</li>
      <li><span><img src="../images/t09.png" /></span>导出</li>
      <li><span><img src="../images/t07.png" /></span>打印</li>
      <li><span><img src="../images/t08.png" /></span>审核</li>
    </ul>
    <span class="x-right" style="line-height:25px">共有数据：88 条</span></xblock>
  </div>
            <table class="tablelist">
                <thead>
                    <tr>
                        <th>
                            <input onclick="selectAll()" type="checkbox" name="controlAll" style="controlAll" id="controlAll">
                        </th>
                        <th>
                            药品编号
                        </th>
                        <th>
                            药品名称
                        </th>
                        <th>
                            剂型
                        </th>
                        <th>
                            规格
                        </th>
                        <th>
                            单位
                        </th>
                        <th>
                            类别
                        </th>
                        <th>
                            保质期
                        </th>
                        <th>
                            状态
                        </th>
                        <th>
                            操作
                        </th>
                    </tr>
                </thead>
                <tbody>

                <c:forEach items="${page.rows }" var="yaopin">
                    <tr>
                        <td>
                            <input type="checkbox" value="1" name="selected">
                        </td>
                        <td>
                            ${yaopin.ycode}
                        </td>
                        <td><u style="cursor:pointer" onclick="user_management_show('宋加加','user_management_show.html','10001','360','400')">
                                ${yaopin.yname}
                        </u></td>
                        <td >
                            ${yaopin.jixing}
                        </td>
                        <td >
                                ${yaopin.guige}
                        </td>
                        <td >
                                ${yaopin.danwei}
                        </td>
                        <td>
                                ${yaopin.leibie}
                        </td>
                        <td>
                            <fmt:formatDate value="${yaopin.yval}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td class="td-status">
                            <c:if test="${yaopin.zhuangtai == 1}">
                            <button class="sp">充足</button>
                            </c:if>
                            <c:if test="${yaopin.zhuangtai == 0}">
                            <button class="sp2">缺货</button>
                            </c:if>
                        </td>
                        <td class="td-manage">
                            <a style="text-decoration:none" onclick="member_stop(this,'10001')" href="javascript:;" title="停用">
                                <i class="layui-icon">&#xe601;</i>
                            </a>
                            <a title="编辑" href="javascript:;" onclick="user_management_edit('编辑','user_management_edit.html','4','','510')"
                            class="ml-5" style="text-decoration:none">
                                <i class="layui-icon">&#xe642;</i>
                            </a>
                            <a style="text-decoration:none"  onclick="user_management_password('修改密码','user_management_password.html','10001','600','400')"
                            href="javascript:;" title="修改密码">
                                <i class="layui-icon">&#xe631;</i>
                            </a>
                            <a title="删除" href="javascript:;" onclick="member_del(this,'1')" 
                            style="text-decoration:none">
                                <i class="layui-icon">&#xe640;</i>
                            </a>
                        </td>
                    </tr>
                </c:forEach>




                </tbody>
            </table>
<%--<div class="page"  v-show="show">
  <div class="pagelist"> <span class="jump">上一页</span> <span class="jump">1</span> <span class="jump">2</span> <span class="jump">3</span> <span class="jump">4</span> <span class="jump">5</span> <span class="jump">6</span> <span class="ellipsis">...</span> <span class="jump">下一页</span> <span class="jumppoint">跳转到：</span> <span class="jumpinp">
    <input type="text">
    </span> <span class="jump gobtn">GO</span> </div>
</div>--%>
        <div>
            <div id="page_container">
            </div>
        </div>


</div>
<br />
<br />
<br />
        <script src="../lib/layui/layui.js" charset="utf-8"></script>
        <script src="../lib/layui/layui.all.js" charset="utf-8"></script>
        <script src="../js/x-layui.js" charset="utf-8"></script>
<script src="../js/jquery2.js" charset="utf-8"></script>
<script src="../js/js.js" charset="utf-8"></script>
        <script>
            layui.use(['laydate','element','laypage','layer'], function(){
                $ = layui.jquery;//jquery
              lement = layui.element();//面包导航
              laypage = layui.laypage;//分页
              layer = layui.layer;//弹出层

            });



             /*用户-添加*/
            function user_management_add(title,url,w,h){
                x_admin_show(title,url,w,h);
            }
            /*用户-查看*/
            function user_management_show(title,url,id,w,h){
                x_admin_show(title,url,w,h);
            }

             /*用户-停用*/
            function member_stop(obj,id){
                layer.confirm('确认要停用吗？',function(index){
                    //发异步把用户状态进行更改
                    $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="layui-icon">&#xe62f;</i></a>');
                    $(obj).parents("tr").find(".td-status").html('<button class="sp3">已停用</button>');
                    $(obj).remove();
                    layer.msg('已停用!',{icon: 5,time:1000});
                });
            }

            /*用户-启用*/
            function member_start(obj,id){
                layer.confirm('确认要启用吗？',function(index){
                    //发异步把用户状态进行更改
                    $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="layui-icon">&#xe601;</i></a>');
                    $(obj).parents("tr").find(".td-status").html('<button class="sp">已启用</button>');
                    $(obj).remove();
                    layer.msg('已启用!',{icon: 6,time:1000});
                });
            }
            // 用户-编辑
            function user_management_edit (title,url,id,w,h) {
                x_admin_show(title,url,w,h); 
            }
            /*密码-修改*/
            function user_management_password(title,url,id,w,h){
                x_admin_show(title,url,w,h);  
            }
           
	$('.tablelist tbody tr:odd').addClass('odd');

            layui.use('form', function(){
                var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

                //……

                //但是，如果你的HTML是动态生成的，自动渲染就会失效
                //因此你需要在相应的地方，执行下述方法来手动渲染，跟这类似的还有 element.init();
                form.render();
            });
            </script>
<script type="text/javascript">
$(document).ready(function () {


    var laypage = layui.laypage;
    laypage.render({
        elem: 'page_container',
        count:'${page.total}',
        limit: 2,
        curr:${fenye} , //获取hash值为fenye的当前页
        jump:function (obj,first) {
            //首次不执行
            page1 = obj.curr;
            if(!first){
                //do something
                fenye=obj.curr;
                window.location.href='/selectYaopin?currpage='+obj.curr+"&rows=2";
            }

        }
    });
})

</script>

    </body>
</html>